package top.xchch.tool.mockito.juejin;

import org.junit.Test;

import java.util.List;

import static org.mockito.Mockito.*;

/**
 * 重置mock
 * Don't harm yourself. reset() in the middle of the test method is a code smell (you're probably testing too much).
 *
 * @author sai.zhang
 * @date 2021-08-31 15:40
 */
public class ResetTest16 {

    @Test
    public void testReset() throws Exception {
        List mock = mock(List.class);
        when(mock.size()).thenReturn(10);
        mock.add(1);
        reset(mock);

        //从这开始，之前的交互和stub将全部失效
        System.out.println(mock.size());
    }

}
